//
//  TMGApplySignViewController.m
//  TMGold
//
//  Created by Mac on 2017/12/9.
//  Copyright © 2017年 tangmu. All rights reserved.
//

#import "TMGApplySignViewController.h"

@interface TMGApplySignViewController ()

@end

@implementation TMGApplySignViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"黄金口袋安全再加固";
    [self configSubView];
    [self configBottomView];
    // Do any additional setup after loading the view.
}

#pragma mark --subView
- (void)configSubView{
    UIView * header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, UIScreenWidth, 100)];
    header.backgroundColor = [UIColor whiteColor];
    
    STButton * buyButton = [[STButton alloc] initWithFrame:CGRectMake(0, 0, UIScreenWidth - 0, 44)
                                                     title:@"黄金口袋安全在加固"
                                                titleColor:TM_orangeColor
                                                 titleFont:14
                                              cornerRadius:0
                                           backgroundColor:self.tableView.backgroundColor
                                           backgroundImage:nil
                                                     image:[UIImage imageNamed:@"申请"]];
    [header addSubview:buyButton];
    buyButton.imageEdgeInsets = UIEdgeInsetsMake(0, 15, 0, 0);
    buyButton.titleEdgeInsets = UIEdgeInsetsMake(0, 30, 0, 0);
    
    NSString * desStr = @"·为了更大程度的保证您的合法权益,黄金口袋将为您申请和您个人身份绑定的电子签名证书，确认您的黄金口袋签订的每一份合同都具有和纸质合同同等的法律效力，让您的投资更加有法律保障。";
    STLabel * desLable = [[STLabel alloc] initWithFrame:CGRectMake(15, buyButton.bottom +10, UIScreenWidth - 30, 200)
                                                   text:desStr
                                              textColor:TM_secendTextColor
                                                   font:14
                                            isSizetoFit:NO
                                          textAlignment:NSTextAlignmentLeft];
    [NSString lableAutoAdjustheightWithLabel:desLable];
    desLable.height = desLable.height + 10;
    //    desLable.attributedText = [desLable.text st_convertAttributeStringWithKeyWords:@[@"·",@"·",@"·"] attributes:@[@{NSForegroundColorAttributeName:TM_orangeColor},@{NSForegroundColorAttributeName:TM_orangeColor},@{NSForegroundColorAttributeName:TM_orangeColor}]];
    [header addSubview:desLable];
    
    header.height = desLable.bottom ;
    self.tableView.tableHeaderView = header;
}
- (void)configBottomView{
    UIView * bootomView = [[UIView alloc] initWithFrame:CGRectMake(0 , 0, UIScreenWidth, 94)];
    bootomView.backgroundColor = [UIColor whiteColor];
    bootomView.bottom = UIScreenHeight;
    [self.view addSubview:bootomView];
    
    STButton * desButton = [[STButton alloc] initWithFrame:CGRectMake(0, 0, UIScreenHeight, 44)
                                                     title:@"我已经认真阅读并同意该用户协议"
                                                titleColor:TM_secendTextColor
                                                 titleFont:14
                                              cornerRadius:0
                                           backgroundColor:self.tableView.backgroundColor
                                           backgroundImage:nil
                                                     image:[UIImage imageNamed:@"yi_xuanzhong"]];
    desButton.imageEdgeInsets = UIEdgeInsetsMake(0, 15, 0, 0);
    desButton.titleEdgeInsets = UIEdgeInsetsMake(0, 30, 0, 0);
    [bootomView addSubview:desButton];
    
    __weak typeof(self) weakSelf =  self;
    STButton * nextButton = [[STButton alloc] initWithFrame:CGRectMake(0, desButton.bottom, UIScreenWidth / 2, 50)
                                                     title:@"下次再说"
                                                titleColor:TM_orangeColor
                                                 titleFont:15
                                              cornerRadius:0
                                           backgroundColor:[UIColor whiteColor]
                                           backgroundImage:nil
                                                     image:nil];
    nextButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
    [nextButton setClicAction:^(UIButton *sender) {
        [weakSelf onSelectedNextButton];
    }];
    [bootomView addSubview:nextButton];
    
    STButton * confim = [[STButton alloc] initWithFrame:CGRectMake(nextButton.right, desButton.bottom, UIScreenWidth / 2, 50)
                                                      title:@"确定"
                                                 titleColor:[UIColor whiteColor]
                                                  titleFont:15
                                               cornerRadius:0
                                            backgroundColor:TM_orangeColor
                                            backgroundImage:nil
                                                      image:nil];
    confim.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
    [confim setClicAction:^(UIButton *sender) {
        [weakSelf onSelectedConfimButton];
    }];
    [bootomView addSubview:confim];
}
#pragma mark --Action Method
- (void)onSelectedNextButton{
 [self.navigationController popViewControllerAnimated:YES];
}
- (void)onSelectedConfimButton{

    [SVProgressHUD showSuccessWithStatus:@"已提交申请"];
    [self.navigationController popViewControllerAnimated:YES];
   
}

@end
